{include file="public/header" /}
<style>
	body {
		background: #e1e0de;
	}

	* {
		box-sizing: border-box;
	}

	h1,
	h2,
	h3,
	h4 {
		font-weight: 700 !important;
	}

	.layui-card-header {
		width: 100%;
		border-bottom: 1px solid #999 !important;
		padding-left: 5px;
	}

	.layui-card {
		padding: 10px 20px 50px;
	}

	p {
		margin: 0 0 10px !important;
	}

	.layui-container {
		padding: 0 !important;
	}

	img {
		max-width: 100%;
	}

	::-moz-selection {
		background: #cccccc;
		color: #ffffff;
	}

	::selection {
		background: #cccccc;
		color: #ffffff;
	}

	.layui-breadcrumb {
		padding-left: 5px;
	}

	.layui-card h1 {
		margin: 10px auto 0;
	}

	.description {
		font-size: 15px;
		font-weight: bold;
		margin: 20px 0;
	}

	.layui-textarea {
		resize: none !important;
	}

	@media screen and (max-width: 800px) {
		.layui-card-header {
			line-height: normal !important;
			font-size: 10px !important;
		}
	}


	.layui-card-body {
		padding: 10px 5px;
	}

	.layui-bg-gray {
		margin-bottom: 10px;
		padding: 10px;
	}

	.tijiao {
		background-color: #f7c542;
		font-weight: bold;
		border-radius: 5px;
		height: 30px;
		line-height: 30px;
		padding: 0 10px;
	}

	.tijiao:hover {
		opacity: 0.7;
	}


	@media screen and (max-width: 760px)  {
		.code-button{
			position: absolute;
			bottom: -13rem;
			left: 3rem;
		}
		.layui-form-phone{
			height: 28rem;
		}
		.phone-comments{
			width: 22% !important;
		}
		.phone-comments-input{
			width: 80% !important;
		}
		#code_div{
			margin-top: 14.5rem;
		}
	}

</style>


<div class="layui-container body-content"
	 style='font: 12px/14px arial,helvetica,sans-serif;'>
	<div class="layui-card">
		<span class="layui-breadcrumb" lay-separator="/">
      <a href="/" style="font: 12px/14px arial,helvetica,sans-serif;">{:lang('Home')}</a>
      {foreach $crumbs as $k=>$v }
      <a href="/{$v['crumbs_url']}" style="font: 12px/14px arial,helvetica,sans-serif;color:#36648A">{$v['alias_name']}</a>
      {/foreach}
    </span>
		<div class="layui-card-header">
			<h1>{:lang('Contact Us')}</h1>
		</div>
		<div class="layui-card-body" style="height:auto">
			<div class="layui-bg-gray" style="height:auto" >


				<div style='float:right;width:97%'>
					<p style='color: #333;line-height: 24px;'>{:lang('Do you have questions regarding our bearings, or do you need more information concerning our products? Get in touch with us today to talk with our experts and learn how we can best benefit you and your business. We generally respond within 24 hours, or typically same day if you’re reaching out during business hours. ')}</p>
					<div class="layui-form layui-form-phone">
						<style type="text/css">
							.layui-col-sm4{
								position: static
							}
						</style>

						<div class="layui-col-sm4" style="padding: 10px 10px">
							<div style="float:left;width:20%;height: 40px;line-height: 40px;color: #333;">{:lang('Name')}<span
									style="color:#36648a;font-size:18px">*</span>:</div>
							<div class="layui-input-block" style="float:right;width:80%;height:40px">
								<input type="text" name="name" placeholder="{:lang('Your first name')}"
									   autocomplete="off" class="layui-input" />
							</div>
						</div>
						<div class="layui-col-sm4" style="padding: 10px 10px">
							<div style="float:left;width:20%;height: 40px;line-height: 40px;color: #333;">{:lang('Company')}:</div>
							<div class="layui-input-block" style="float:right;width:80%;height:40px">
								<input type="text" name="company" placeholder="{:lang('Your company name')}"
									   autocomplete="off" class="layui-input" />
							</div>
						</div>
						<div class="layui-col-sm4" style="padding: 10px 10px">
							<div style="float:left;width:20%;height: 40px;line-height: 40px;color: #333;">{:lang('Email')}<span
									style="color:#36648a;font-size:18px">*</span>:</div>
							<div class="layui-input-block" style="float:right;width:80%;height:40px">
								<input type="text" name="email" placeholder="{:lang('Your email address')}" autocomplete="off" class="layui-input" />
							</div>

						</div>
						<div class="layui-col-sm4" style="padding: 10px 10px">
							
							<div style="float:left;width:20%;height: 40px;line-height: 40px;color: #333;">{:lang('Phone')}<span
									style="color:#36648a;font-size:18px">*</span>:</div>
							<div class="layui-input-block" style="float:right;width:80%;height:40px">
								<input type="text" name="phone" placeholder="{:lang('Your phone number')}" autocomplete="off"
									   class="layui-input" />
							</div>
							
						</div>

						<div class="layui-col-sm4" style="padding: 10px 10px">
							<div style="float:left;width:20%;height: 40px;line-height: 40px;color: #333;">{:lang('File')}:</div>
							<div class="layui-input-block layui-input"
								 style="float:right;width:80%;height:40px;line-height:40px">
								<input type="button" id="miaoshu" value="{:lang('Select File')}"
									   onclick="javascript:$('input[name=\'fileName\']').click();"
									   style="background-color: #FFFFFF;border: 1px solid #ccc;font-weight: normal;color: #858585;border-radius: 5px;cursor: pointer;padding:2px 5px"
									   class=" text" />
								<input name="file" placeholder="{:lang('No file are selected')}" readonly
									   onclick="javascript:$('input[name=\'fileName\']').click();"
									   style="width: 60%; border: none;" />
								<input type="file" id="fileName" name="fileName" style="display: none;"
									   onchange="javascript:$('input[name=\'file\']').val(value);$('input[name=\'file\']').prop('size',this.value.length+6);" />
							</div>
						</div>
						<div class="layui-col-sm4" style="padding: 10px 10px">
							<div style="float:left;width:100%;height: 20px;line-height: 20px;color: #333;">{:lang('Accepted file types: gif、jpeg、jpg、png、pdf、txt、doc、xls、xlsx、docx), Max. file size: 2 MB.')}</div>
						</div>
						<div class="layui-col-sm8 " style="padding: 10px 10px">
							<div class="phone-comments" style="float:left;width:10%;height: 40px;line-height: 40px;color: #333;">{:lang('Comments')}:</div>
							<div class="layui-input-block phone-comments-input" style="float:right;width:90%;">
								<textarea name="comments" placeholder="{:lang('Tell us about the type, the size and the amount of bearings you need and our sales engineers will make offers.')}"
										  class="layui-textarea"></textarea>
							</div>
						</div>
						<div class="layui-col-sm4 code-button-box" style="padding: 10px 10px">
							<!-- 验证码 -->
							<?php if($base_data['is_show_code']==true){?>
							<div class="layui-form-item" id="code_div">
								<div class="verification-code">
									<div style="float:left;width:20%;height: 40px;line-height: 40px;color: #333;">code<span style="color:#36648a;font-size:18px">*</span>:</div>
									<input class="verification-code-input layui-input" type="text" name="code" placeholder="{:lang('Verification code')}"/>
									<div class="verification-code-img">

										<img src="{:url('index/xunpan/verify')}" style="margin-top: 10px;width: 50%;" id="code_img" onclick="this.src=this.src.split('?')[0] + '?'+new Date().getTime()" title="Click to change one" >
									</div>
								</div>
							</div>
							<?php } ?>

						<div class="layui-col-sm4 code-button" style="padding: 0px 10px">
							<div class="layui-input-block button" style="float:left;margin-top: 54px">
								<button id='gform_submit_button_2' class="layui-btn btn tijiao" lay-filter="formDemo" lay-submit type='button' style="color:black">{:lang('Submit')}</button>
							</div>
						</div>

					</div>
				</div>
			</div>

			<div style="clear:both"></div>
		</div>
		<div class="layui-bg-gray">

			<div style='float:right;width:97%'>
				<p style='color: #333;line-height: 24px;'>{:lang('You can contact us at.')}</p>
				<p style='color: #333;line-height: 24px;'>
					{:lang('Phone')}：0086 400-803-9661</br>
					{:lang('Address: Room 301, 6st Block, #525 Yuanjiang Road, Minhang District, Shanghai, China')}</br>
					{:lang('Zip code：200231')}</br>
					{:lang('Email')}: <a class='email' href="mailto:lilybearing@lily-bearing.com">lilybearing@lily-bearing.com</a>
				</p>

			</div>
			<div style="clear:both"></div>
		</div>
	</div>
</div>
</div>
{include file="/public/footer" /}

<script type="text/javascript">
	layui.use('form', function() {
		var form = layui.form;

		form.on('submit(formDemo)', function(data) {
			var index = layer.load(1, {
				shade: [0.1, '#fff']
			});
			var fileName = document.getElementById('fileName').files[0];
			var name = $.trim($("input[name='name']").val());
			var company = $.trim($("input[name='company']").val());
			var email = $.trim($("input[name='email']").val());
			var phone = $.trim($("input[name='phone']").val());
			var code = $.trim($("input[name='code']").val());
			var comments = $.trim($("textarea[name='comments']").val());
			var Product_Number = '';

			var lasturl=<?php if(isset($_SERVER['HTTP_REFERER'])){ echo "'".$_SERVER['HTTP_REFERER']."'";}else{echo "'"."'";}?>;/*上一个页面的url 不能在ajax里面书写这样就多了一层页面关系*/
			var nowurl=window.location.href;/*当前页面url*/

			var formData = new FormData();
			if (fileName != undefined) {
				formData.append('file', fileName);
			}
			formData.append('name', name);
			formData.append('company', company);
			formData.append('email', email);
			formData.append('phone', phone);
			formData.append('comments', comments);
			formData.append('lasturl', lasturl);
			formData.append('nowurl', nowurl);
			formData.append('code', code);
			formData.append('Product_Number', Product_Number);

			$.ajax({
				url: "{:url('index/xunpan/send_inquiry')}",
				/*传向后台服务器文件*/
				type: 'POST',
				/*传递方法 */
				data: formData,
				/*要带的值，在这里只能带一个formdata ，不可以增加其他*/
				dataType: 'json', //传递数据的格式
				async: true, //这是重要的一步，防止重复提交的
				cache: false, //设置为false，上传文件不需要缓存。
				contentType: false, //设置为false,因为是构造的FormData对象,所以这里设置为false。
				processData: false, //设置为false,因为data值是FormData对象，不需要对数据做处理。

				success: function(res) {
					if (res.status == 1) {
						layer.closeAll('loading');
						$(".layui-form input").each(function() {
							$(this).val('');
						})
						layer.msg(res.msg, {
							time: 2000,
							icon: 1
						}, function() {
							location.href = "/thank-you/";
						});
						return false;
					} else {
						layer.msg(res.msg, {
							time: 2000,
							icon: 5
						});
						layer.closeAll('loading');
						return false;
					}
				}
			});

			return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
		});
	})
</script>
